package com.myhome.money.redis.pubsub;

import redis.clients.jedis.Jedis;

/**
 * @author Rod
 */
public class Publish {

    public static void main(String[] args) {
        Publish publish = new Publish();
        try {
            publish.testPublish();
            System.in.read();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void testPublish() throws Exception {
        Jedis jedis = new Jedis("localhost", 6379);
        jedis.auth("RedisAdmin");
        jedis.publish("redisChatTest", "我是天才");
        Thread.sleep(5000);
        jedis.publish("redisChatTest", "我牛逼");
        Thread.sleep(5000);
        jedis.publish("redisChatTest", "哈哈");
    }
}
